package cn.iocoder.yudao.module.api.trade.order.dto;

import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.api.trade.delivery.enums.DeliveryTypeEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import lombok.Data;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/03/31
 */
@Data
@Valid
public class GiftTradeOrderSaveDTO {

    @Schema(description = "店铺编号", example = "1")
    private Long shopId;

    @Schema(description = "名称", example = "价值58元的烤鱼1条")
    private String name;

    @Schema(description = "图片")
    private String picUrl;

    @Schema(description = "产品 SKU 编号", example = "1")
    private Long skuId;

    @Schema(description = "购买数量", example = "1")
    private Integer count;

    @Schema(description = "原价价", example = "1")
    private Integer originPrice;

    @Schema(description = "成本价", example = "1")
    private Integer costPrice;

    @SuppressWarnings("unused")
    @AssertTrue(message = "产品 SKU信息无效")
    @JsonIgnore
    public boolean isValid() {
        return skuId != null && skuId > 0 && count != null && count > 0;
    }

    @Schema(description = "配送类型/服务方式：0-无、1-快递发货、2-到店自提、3-同城配送、4-现场核销、5-上门服务", example = "0")
    @InEnum(value = DeliveryTypeEnum.class, message = "配送类型/服务方式不正确")
    private Integer deliveryType;

    @Schema(description = "上门服务地址或收货地址编号", example = "0")
    private Long addressId;

    @Schema(description = "备注", example = "这个是我的订单哟")
    private String remark;

}
